import redis


class Config(object):
    SECRET_KEY = 'asdfasd123@awer'

    # 数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@127.0.0.1:3306/ihome'
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True  # 对cookie数据进行隐藏处理
    PERMANENT_SESSION_LIFETIME = 86400  # session有效期，单位秒


# 开发环境
class DevelopmentConfig(Config):
    DEBUG = True


# 生产环境
class ProductionConfig(Config):
    pass


config_map = {
    "develop": DevelopmentConfig,
    "product": ProductionConfig
}
